home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / GameSprocket SDKs / InputSprocket SDK / Interfaces&Libraries / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-07  |  40.5 KB  |  1,329 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    InputSprocket 1.7
  7.                  Release:    InputSprocket SDK, Use 3.2 Universal Headers
  8.  
  9.      Copyright:    © 1996-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __INPUTSPROCKET__
  18. #define __INPUTSPROCKET__
  19.  
  20. #ifndef __DESKBUS__
  21. #include <DeskBus.h>
  22. #endif
  23.  
  24. #ifndef __DIALOGS__
  25. #include <Dialogs.h>
  26. #endif
  27.  
  28. #ifndef __EVENTS__
  29. #include <Events.h>
  30. #endif
  31.  
  32. #ifndef __ICONS__
  33. #include <Icons.h>
  34. #endif
  35.  
  36. #ifndef __MACTYPES__
  37. #include <MacTypes.h>
  38. #endif
  39.  
  40. #ifndef __MACERRORS__
  41. #include <MacErrors.h>
  42. #endif
  43.  
  44.  
  45.  
  46.  
  47. #if PRAGMA_ONCE
  48. #pragma once
  49. #endif
  50.  
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54.  
  55. #if PRAGMA_IMPORT
  56. #pragma import on
  57. #endif
  58.  
  59. #if PRAGMA_STRUCT_ALIGN
  60.     #pragma options align=power
  61. #elif PRAGMA_STRUCT_PACKPUSH
  62.     #pragma pack(push, 2)
  63. #elif PRAGMA_STRUCT_PACK
  64.     #pragma pack(2)
  65. #endif
  66.  
  67. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  68. #define USE_OLD_INPUT_SPROCKET_LABELS 0
  69. #endif  /* !defined(USE_OLD_INPUT_SPROCKET_LABELS) */
  70.  
  71. #ifndef USE_OLD_ISPNEED_STRUCT
  72. #define USE_OLD_ISPNEED_STRUCT 0
  73. #endif  /* !defined(USE_OLD_ISPNEED_STRUCT) */
  74.  
  75. /* ********************* data types ********************* */
  76. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  77. typedef struct OpaqueISpElementReference*  ISpElementReference;
  78. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  79. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  80. typedef OSType                             ISpDeviceClass;
  81. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  82. typedef OSType                             ISpDeviceIdentifier;
  83. typedef OSType                             ISpElementLabel;
  84. typedef OSType                             ISpElementKind;
  85.  
  86.  
  87. /* *************** resources **************** */
  88. enum {
  89.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  90.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  91.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  92. };
  93.  
  94.  
  95. struct ISpApplicationResourceStruct {
  96.     UInt32                             flags;
  97.     UInt32                             reserved1;
  98.     UInt32                             reserved2;
  99.     UInt32                             reserved3;
  100. };
  101. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  102. enum {
  103.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  104.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  105. };
  106.  
  107. /*
  108.  * ISpDeviceDefinition
  109.  *
  110.  * This structure provides all the available
  111.  * information for an input device within the system
  112.  *
  113.  */
  114.  
  115. struct ISpDeviceDefinition {
  116.     Str63                             deviceName;                    /* a human readable name of the device */
  117.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  118.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  119.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  120.     UInt32                             flags;                        /* status flags */
  121.     UInt32                             permanentIDExtend;            /* extension of permanentID, so 64 bits total are now significant */
  122.     UInt32                             reserved2;
  123.     UInt32                             reserved3;
  124. };
  125. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  126. enum {
  127.     kISpDeviceFlag_HandleOwnEmulation = 1
  128. };
  129.  
  130. /*
  131.  * ISpElementEvent, ISpElementEventPtr
  132.  *
  133.  * This is the structure that event data is passed in.
  134.  *
  135.  */
  136.  
  137. struct ISpElementEvent {
  138.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  139.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  140.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  141.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  142.     UInt32                             data;                        /* the data for this event */
  143. };
  144. typedef struct ISpElementEvent            ISpElementEvent;
  145. typedef ISpElementEvent *                ISpElementEventPtr;
  146. /*
  147.  * ISpElementInfo, ISpElementInfoPtr
  148.  *
  149.  * This is the generic definition of an element.
  150.  * Every element must contain this information.
  151.  *
  152.  */
  153.  
  154. struct ISpElementInfo {
  155.     ISpElementLabel                 theLabel;
  156.     ISpElementKind                     theKind;
  157.     Str63                             theString;
  158.     UInt32                             reserved1;
  159.     UInt32                             reserved2;
  160. };
  161. typedef struct ISpElementInfo            ISpElementInfo;
  162. typedef ISpElementInfo *                ISpElementInfoPtr;
  163.  
  164. typedef UInt32                             ISpNeedFlagBits;
  165. #if USE_OLD_ISPNEED_STRUCT
  166.  
  167. struct ISpNeed {
  168.     Str63                             name;
  169.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  170.     short                             reserved;
  171.     ISpElementKind                     theKind;
  172.     ISpElementLabel                 theLabel;
  173.     ISpNeedFlagBits                 flags;
  174.     UInt32                             reserved1;
  175.     UInt32                             reserved2;
  176.     UInt32                             reserved3;
  177. };
  178. typedef struct ISpNeed                    ISpNeed;
  179. #else
  180.  
  181. struct ISpNeed {
  182.     Str63                             name;                        /* human-readable string */
  183.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  184.     UInt8                             playerNum;                    /* used for multi-player support */
  185.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  186.     ISpElementKind                     theKind;
  187.     ISpElementLabel                 theLabel;
  188.     ISpNeedFlagBits                 flags;
  189.     UInt32                             reserved1;
  190.     UInt32                             reserved2;
  191.     UInt32                             reserved3;
  192. };
  193. typedef struct ISpNeed                    ISpNeed;
  194. #endif  /* USE_OLD_ISPNEED_STRUCT */
  195.  
  196. enum {
  197.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  198.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  199.     kISpNeedFlag_PolledOnly        = 0x00000004,
  200.     kISpNeedFlag_EventsOnly        = 0x00000008,
  201.     kISpNeedFlag_NoAutoConfig    = 0x00000010,                    /* this need can be set normally, but will not ever be auto configured*/
  202.     kISpNeedFlag_NoConfig        = 0x00000020,                    /* this need can not be changed by the user*/
  203.     kISpNeedFlag_Invisible        = 0x00000040,                    /* this need can not be seen by the user*/
  204.                                                                 /* *** kISpElementKind specific flags ****/
  205.                                                                 /* these are flags specific to kISpElementKind_Button*/
  206.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  207.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  208.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,
  209.     kISpNeedFlag_Button_AlreadyDelta = (long)0x80000000,        /* there is a delta version of this button need*/
  210.                                                                 /* these are flags specific to kISpElementKind_DPad*/
  211.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  212.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  213.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  214.     kISpNeedFlag_Axis_AlreadyDelta = 0x40000000,                /* there is a delta version of this axis need*/
  215.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  216.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000,                /* there is a axis version of this delta need*/
  217.     kISpNeedFlag_Delta_AlreadyButton = 0x20000000                /* there is a button version of this delta need*/
  218. };
  219.  
  220. /*
  221.  *
  222.  * These are the current built values for ISpDeviceClass
  223.  *
  224.  */
  225. enum {
  226.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  227.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  228.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  229.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  230.     kISpDeviceClass_Gamepad        = FOUR_CHAR_CODE('gmpd'),
  231.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  232.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  233.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  234.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl'),        /* a device of this class requires ISpTickle*/
  235.     kISpDeviceClass_Unknown        = FOUR_CHAR_CODE('????')
  236. };
  237.  
  238. /*
  239.  * These are the current built in ISpElementKind's
  240.  * 
  241.  * These are all OSTypes.
  242.  *
  243.  */
  244. enum {
  245.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  246.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  247.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  248.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  249.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  250.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  251. };
  252.  
  253.  
  254. /*
  255.  *
  256.  * These are the current built in ISpElementLabel's
  257.  *
  258.  * These are all OSTypes.
  259.  *
  260.  */
  261. #if USE_OLD_INPUT_SPROCKET_LABELS
  262. enum {
  263.                                                                 /* axis */
  264.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  265.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  266.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  267.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  268.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  269.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  270.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  271.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  272.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  273.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  274.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  275.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  276.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  277.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  278.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  279.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn'),        /* Pause/Resume was changed into 2 needs: Quit and start/pause */
  280.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt')
  281. };
  282.  
  283. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  284.  
  285. enum {
  286.                                                                 /* generic */
  287.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  288.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  289.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  290.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  291.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  292.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  293.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  294.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  295.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  296.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  297.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  298.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  299.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  300.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  301.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  302.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  303.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  304.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  305.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),
  306.     kISpElementLabel_Axis_ToeBrake = FOUR_CHAR_CODE('toeb'),    /* delta */
  307.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  308.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  309.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  310.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  311.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  312.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  313.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  314.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  315.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,
  316.     kISpElementLabel_Delta_Cursor_X = FOUR_CHAR_CODE('curx'),
  317.     kISpElementLabel_Delta_Cursor_Y = FOUR_CHAR_CODE('cury'),    /* direction pad */
  318.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),        /* up/down/left/right*/
  319.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* up/down/left/right*/
  320.     kISpElementLabel_Pad_POV_Horiz = FOUR_CHAR_CODE('hpov'),    /* forward/back/left/right*/
  321.     kISpElementLabel_Pad_Move_Horiz = FOUR_CHAR_CODE('hmov'),    /* forward/back/left/right*/
  322.                                                                 /* buttons */
  323.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  324.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  325.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  326.     kISpElementLabel_Btn_Quit    = FOUR_CHAR_CODE('strt'),        /* kISpElementLabel_Btn_Quit automatically binds to escape */
  327.     kISpElementLabel_Btn_StartPause = FOUR_CHAR_CODE('paus'),
  328.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  329.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  330.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  331.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  332.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  333.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  334.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  335.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  336.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  337.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  338.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  339.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  340.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  341.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  342.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  343.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok'),
  344.     kISpElementLabel_Btn_Minimum = FOUR_CHAR_CODE('min '),
  345.     kISpElementLabel_Btn_Decrement = FOUR_CHAR_CODE('decr'),
  346.     kISpElementLabel_Btn_Center    = FOUR_CHAR_CODE('cent'),
  347.     kISpElementLabel_Btn_Increment = FOUR_CHAR_CODE('incr'),
  348.     kISpElementLabel_Btn_Maximum = FOUR_CHAR_CODE('max '),
  349.     kISpElementLabel_Btn_10Percent = FOUR_CHAR_CODE(' 10 '),
  350.     kISpElementLabel_Btn_20Percent = FOUR_CHAR_CODE(' 20 '),
  351.     kISpElementLabel_Btn_30Percent = FOUR_CHAR_CODE(' 30 '),
  352.     kISpElementLabel_Btn_40Percent = FOUR_CHAR_CODE(' 40 '),
  353.     kISpElementLabel_Btn_50Percent = FOUR_CHAR_CODE(' 50 '),
  354.     kISpElementLabel_Btn_60Percent = FOUR_CHAR_CODE(' 60 '),
  355.     kISpElementLabel_Btn_70Percent = FOUR_CHAR_CODE(' 70 '),
  356.     kISpElementLabel_Btn_80Percent = FOUR_CHAR_CODE(' 80 '),
  357.     kISpElementLabel_Btn_90Percent = FOUR_CHAR_CODE(' 90 '),
  358.     kISpElementLabel_Btn_MouseOne = FOUR_CHAR_CODE('mou1'),
  359.     kISpElementLabel_Btn_MouseTwo = FOUR_CHAR_CODE('mou2'),
  360.     kISpElementLabel_Btn_MouseThree = FOUR_CHAR_CODE('mou3')
  361. };
  362.  
  363. /*
  364.  *
  365.  * direction pad data & configuration information
  366.  *
  367.  */
  368.  
  369. typedef UInt32 ISpDPadData;
  370. enum {
  371.     kISpPadIdle                    = 0,
  372.     kISpPadLeft                    = 1,
  373.     kISpPadUpLeft                = 2,
  374.     kISpPadUp                    = 3,
  375.     kISpPadUpRight                = 4,
  376.     kISpPadRight                = 5,
  377.     kISpPadDownRight            = 6,
  378.     kISpPadDown                    = 7,
  379.     kISpPadDownLeft                = 8
  380. };
  381.  
  382.  
  383. struct ISpDPadConfigurationInfo {
  384.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  385.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  386. };
  387. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  388. /*
  389.  *
  390.  * button data & configuration information
  391.  *
  392.  */
  393.  
  394. typedef UInt32 ISpButtonData;
  395. enum {
  396.     kISpButtonUp                = 0,
  397.     kISpButtonDown                = 1
  398. };
  399.  
  400.  
  401. struct ISpButtonConfigurationInfo {
  402.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  403. };
  404. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  405. /*
  406.  *
  407.  * axis data & configuration information 
  408.  *
  409.  */
  410.  
  411. typedef UInt32                             ISpAxisData;
  412.  
  413. #define    kISpAxisMinimum  0x00000000U
  414. #define    kISpAxisMiddle   0x7FFFFFFFU
  415. #define    kISpAxisMaximum  0xFFFFFFFFU
  416.  
  417.  
  418. struct ISpAxisConfigurationInfo {
  419.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  420. };
  421. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  422.  
  423. typedef Fixed                             ISpDeltaData;
  424.  
  425. struct ISpDeltaConfigurationInfo {
  426.     UInt32                             reserved1;
  427.     UInt32                             reserved2;
  428. };
  429. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  430.  
  431. struct ISpMovementData {
  432.     ISpAxisData                     xAxis;
  433.     ISpAxisData                     yAxis;
  434.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  435. };
  436. typedef struct ISpMovementData            ISpMovementData;
  437.  
  438. struct ISpMovementConfigurationInfo {
  439.     UInt32                             reserved1;
  440.     UInt32                             reserved2;
  441. };
  442. typedef struct ISpMovementConfigurationInfo ISpMovementConfigurationInfo;
  443. enum {
  444.     kISpVirtualElementFlag_UseTempMem = 1
  445. };
  446.  
  447. enum {
  448.     kISpElementListFlag_UseTempMem = 1
  449. };
  450.  
  451. enum {
  452.     kISpFirstIconSuite            = 30000,
  453.     kISpLastIconSuite            = 30100,
  454.     kISpNoneIconSuite            = 30000
  455. };
  456.  
  457.  
  458. /* ********************* user level functions ********************* */
  459. /*
  460.  *
  461.  * startup / shutdown
  462.  *
  463.  */
  464. #if CALL_NOT_IN_CARBON
  465. EXTERN_API_C( OSStatus )
  466. ISpStartup                        (void);
  467.  
  468. /* 1.1 or later*/
  469. EXTERN_API_C( OSStatus )
  470. ISpShutdown                        (void);
  471.  
  472. /* 1.1 or later*/
  473. /*
  474.  *
  475.  * polling
  476.  *
  477.  */
  478. EXTERN_API_C( OSStatus )
  479. ISpTickle                        (void);
  480.  
  481. /* 1.1 or later*/
  482. /********** user interface functions **********/
  483.  
  484. EXTERN_API_C( NumVersion )
  485. ISpGetVersion                    (void);
  486.  
  487. /*
  488.  *
  489.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  490.  *
  491.  */
  492. EXTERN_API_C( OSStatus )
  493. ISpElement_NewVirtual            (UInt32                 dataSize,
  494.                                  ISpElementReference *    outElement,
  495.                                  UInt32                 flags);
  496.  
  497. /*
  498.  *
  499.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  500.  *
  501.  */
  502. EXTERN_API_C( OSStatus )
  503. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  504.                                  ISpNeed *                needs,
  505.                                  ISpElementReference *    outElements,
  506.                                  UInt32                 flags);
  507.  
  508. /*
  509.  *
  510.  * ISpElement_DisposeVirtual(inElement);
  511.  *
  512.  */
  513. EXTERN_API_C( OSStatus )
  514. ISpElement_DisposeVirtual        (UInt32                 count,
  515.                                  ISpElementReference *    inElements);
  516.  
  517. /*
  518.  * ISpInit
  519.  *
  520.  */
  521. EXTERN_API_C( OSStatus )
  522. ISpInit                            (UInt32                 count,
  523.                                  ISpNeed *                needs,
  524.                                  ISpElementReference *    inReferences,
  525.                                  OSType                 appCreatorCode,
  526.                                  OSType                 subCreatorCode,
  527.                                  UInt32                 flags,
  528.                                  short                     setListResourceId,
  529.                                  UInt32                 reserved);
  530.  
  531.  
  532. /*
  533.  * ISpConfigure
  534.  *
  535.  */
  536. #endif  /* CALL_NOT_IN_CARBON */
  537.  
  538. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  539. #if CALL_NOT_IN_CARBON
  540. EXTERN_API_C( OSStatus )
  541. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  542.  
  543. /*
  544.  *
  545.  * ISpStop
  546.  *
  547.  */
  548. EXTERN_API_C( OSStatus )
  549. ISpStop                            (void);
  550.  
  551. /*
  552.  *
  553.  * ISpSuspend, ISpResume
  554.  *
  555.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  556.  * ISpResume resumes to the previous state of the system after a suspend call.
  557.  * 
  558.  * Return Codes
  559.  * memFullErr
  560.  *
  561.  */
  562. EXTERN_API_C( OSStatus )
  563. ISpSuspend                        (void);
  564.  
  565. EXTERN_API_C( OSStatus )
  566. ISpResume                        (void);
  567.  
  568. /*
  569.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  570.  *
  571.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  572.  *
  573.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  574.  * buffer - a pointer to your buffer
  575.  * outCount - contains the number of devices in the system
  576.  *
  577.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  578.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  579.  *
  580.  * Return Codes
  581.  * paramErr
  582.  *
  583.  */
  584. EXTERN_API_C( OSStatus )
  585. ISpDevices_Extract                (UInt32                 inBufferCount,
  586.                                  UInt32 *                outCount,
  587.                                  ISpDeviceReference *    buffer);
  588.  
  589. EXTERN_API_C( OSStatus )
  590. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  591.                                  UInt32                 inBufferCount,
  592.                                  UInt32 *                outCount,
  593.                                  ISpDeviceReference *    buffer);
  594.  
  595. EXTERN_API_C( OSStatus )
  596. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  597.                                  UInt32                 inBufferCount,
  598.                                  UInt32 *                outCount,
  599.                                  ISpDeviceReference *    buffer);
  600.  
  601.  
  602. /*
  603.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  604.  *
  605.  * ISpDevices_Activate, ISpDevices_Deactivate
  606.  *
  607.  * This will activate/deactivate a block of devices.
  608.  * inDeviceCount - the number of devices to activate / deactivate
  609.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  610.  *
  611.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  612.  * inClass - the class of devices to activate or deactivate
  613.  *
  614.  * ISpDevice_IsActive
  615.  * inDevice - the device reference that you wish to 
  616.  * outIsActive - a boolean value that is true when the device is active
  617.  *
  618.  * Return Codes
  619.  * paramErr
  620.  *
  621.  */
  622. EXTERN_API_C( OSStatus )
  623. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  624.  
  625. /* 1.1 or later*/
  626. EXTERN_API_C( OSStatus )
  627. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  628.  
  629. /* 1.1 or later*/
  630. EXTERN_API_C( OSStatus )
  631. ISpDevices_Activate                (UInt32                 inDeviceCount,
  632.                                  ISpDeviceReference *    inDevicesToActivate);
  633.  
  634. EXTERN_API_C( OSStatus )
  635. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  636.                                  ISpDeviceReference *    inDevicesToDeactivate);
  637.  
  638. EXTERN_API_C( OSStatus )
  639. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  640.                                  Boolean *                outIsActive);
  641.  
  642. /*
  643.  * ISpDevice_GetDefinition
  644.  *
  645.  *
  646.  * inDevice - the device you want to get the definition for
  647.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  648.  * outStruct - a pointer to where you want the structure copied
  649.  *
  650.  * Return Codes
  651.  * paramErr
  652.  *
  653.  */
  654. EXTERN_API_C( OSStatus )
  655. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  656.                                  UInt32                 inBuflen,
  657.                                  ISpDeviceDefinition *    outStruct);
  658.  
  659.  
  660. /*
  661.  *
  662.  * ISpDevice_GetElementList
  663.  *
  664.  * inDevice - the device whose element list you wish to get
  665.  * outElementList - a pointer to where you want a reference to that list stored
  666.  *
  667.  * Return Codes
  668.  * paramErr
  669.  *
  670.  */
  671. EXTERN_API_C( OSStatus )
  672. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  673.                                  ISpElementListReference * outElementList);
  674.  
  675. /*
  676.  *
  677.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  678.  * no group
  679.  *
  680.  * Return Codes
  681.  * paramErr
  682.  *
  683.  */
  684. EXTERN_API_C( OSStatus )
  685. ISpElement_GetGroup                (ISpElementReference     inElement,
  686.                                  UInt32 *                outGroup);
  687.  
  688. /*
  689.  *
  690.  * takes an ISpElementReference and returns the device that the element belongs 
  691.  * to.
  692.  *
  693.  * Return Codes
  694.  * paramErr if inElement is 0 or outDevice is nil
  695.  *
  696.  */
  697. EXTERN_API_C( OSStatus )
  698. ISpElement_GetDevice            (ISpElementReference     inElement,
  699.                                  ISpDeviceReference *    outDevice);
  700.  
  701. /*
  702.  *
  703.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  704.  * the set of standard information.  You get ISpElementKind specific information
  705.  * through ISpElement_GetConfigurationInfo.
  706.  *
  707.  * Return Codes
  708.  * paramErr if inElement is 0 or outInfo is nil
  709.  *
  710.  */
  711. EXTERN_API_C( OSStatus )
  712. ISpElement_GetInfo                (ISpElementReference     inElement,
  713.                                  ISpElementInfoPtr         outInfo);
  714.  
  715. /*
  716.  *
  717.  *         
  718.  *
  719.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  720.  * 
  721.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  722.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  723.  * will return something error.
  724.  *
  725.  * Return Codes
  726.  * paramErr if inElement or configInfo is nil
  727.  *
  728.  */
  729. EXTERN_API_C( OSStatus )
  730. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  731.                                  UInt32                 buflen,
  732.                                  void *                    configInfo);
  733.  
  734. /*
  735.  *
  736.  * ISpElement_GetSimpleState
  737.  *
  738.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  739.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  740.  * whose data fits in a signed 32 bit integer.
  741.  *
  742.  *
  743.  *
  744.  * Return Codes
  745.  * paramErr if inElement is 0 or state is nil
  746.  *
  747.  */
  748. EXTERN_API_C( OSStatus )
  749. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  750.                                  UInt32 *                state);
  751.  
  752. /*
  753.  *
  754.  * ISpElement_GetComplexState
  755.  *
  756.  * Takes an ISpElementReference and returns the current state of that element.  
  757.  * Will copy up to buflen bytes of the current state of the device into
  758.  * state.
  759.  *
  760.  *
  761.  * Return Codes
  762.  * paramErr if inElement is 0 or state is nil
  763.  *
  764.  */
  765. EXTERN_API_C( OSStatus )
  766. ISpElement_GetComplexState        (ISpElementReference     inElement,
  767.                                  UInt32                 buflen,
  768.                                  void *                    state);
  769.  
  770.  
  771. /*
  772.  * ISpElement_GetNextEvent
  773.  *
  774.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  775.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  776.  * was not enough space to fill in the whole event structure that event will be
  777.  * dequed, as much of the event as will fit in the buffer will by copied and
  778.  * ISpElement_GetNextEvent will return an error.
  779.  *
  780.  * Return Codes
  781.  * paramErr
  782.  *
  783.  */
  784. EXTERN_API_C( OSStatus )
  785. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  786.                                  UInt32                 bufSize,
  787.                                  ISpElementEventPtr     event,
  788.                                  Boolean *                wasEvent);
  789.  
  790. /*
  791.  *
  792.  * ISpElement_Flush
  793.  *
  794.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  795.  * that any events that made it to this layer before the time of the flush call will be flushed and
  796.  * it will not flush any events that make it to this layer after the time when the call has returned.
  797.  * What happens to events that occur during the flush is undefined.
  798.  *
  799.  *
  800.  * Return Codes
  801.  * paramErr
  802.  *
  803.  */
  804. EXTERN_API_C( OSStatus )
  805. ISpElement_Flush                (ISpElementReference     inElement);
  806.  
  807.  
  808. /*
  809.  * ISpElementList_New
  810.  *
  811.  * Creates a new element list and returns it in outElementList.  In count specifies 
  812.  * the number of element references in the list pointed to by inElements.  If inCount
  813.  * is non zero the list is created with inCount elements in at as specified by the 
  814.  * inElements parameter.  Otherwise the list is created empty.
  815.  *
  816.  *
  817.  * Return Codes
  818.  * out of memory - If it failed to allocate the list because it was out of memory
  819.                    it will also set outElementList to 0
  820.  * paramErr if outElementList was nil
  821.  *
  822.  *
  823.  * Special Concerns
  824.  *
  825.  * interrupt unsafe
  826.  *
  827.  */
  828. EXTERN_API_C( OSStatus )
  829. ISpElementList_New                (UInt32                 inCount,
  830.                                  ISpElementReference *    inElements,
  831.                                  ISpElementListReference * outElementList,
  832.                                  UInt32                 flags);
  833.  
  834. /*
  835.  * ISpElementList_Dispose
  836.  *
  837.  * Deletes an already existing memory list.  
  838.  *
  839.  *
  840.  * Return Codes
  841.  * paramErr if inElementList was 0
  842.  *
  843.  *
  844.  * Special Concerns
  845.  *
  846.  * interrupt unsafe
  847.  *
  848.  */
  849. EXTERN_API_C( OSStatus )
  850. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  851.  
  852. /*
  853.  * ISpGetGlobalElementList
  854.  *
  855.  * returns the global element list
  856.  *
  857.  * Return Codes
  858.  * paramErr if outElementList is nil
  859.  *
  860.  */
  861. EXTERN_API_C( OSStatus )
  862. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  863.  
  864. /*
  865.  * ISpElementList_AddElement
  866.  *
  867.  * adds an element to the element list
  868.  *
  869.  * Return Codes
  870.  * paramErr if inElementList is 0 or newElement is 0
  871.  * memory error if the system is unable to allocate enough memory
  872.  *
  873.  * Special Concerns
  874.  * interrupt Unsafe
  875.  * 
  876.  */
  877. EXTERN_API_C( OSStatus )
  878. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  879.                                  UInt32                 refCon,
  880.                                  UInt32                 count,
  881.                                  ISpElementReference *    newElements);
  882.  
  883. /*
  884.  * ISpElementList_RemoveElement
  885.  *
  886.  * removes the specified element from the element list
  887.  *
  888.  * Return Codes
  889.  * paramErr if inElementList is 0 or oldElement is 0
  890.  * memory error if the system is unable to allocate enough memory
  891.  *
  892.  * Special Concerns
  893.  * interrupt Unsafe
  894.  * 
  895.  */
  896. EXTERN_API_C( OSStatus )
  897. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  898.                                  UInt32                 count,
  899.                                  ISpElementReference *    oldElement);
  900.  
  901. /*
  902.  * ISpElementList_Extract
  903.  *
  904.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  905.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  906.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  907.  * that number and the size of the array into the buffer.
  908.  *
  909.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  910.  * that have the specified kind and label.
  911.  *
  912.  * Return Codes
  913.  * paramErr
  914.  *
  915.  */
  916. EXTERN_API_C( OSStatus )
  917. ISpElementList_Extract            (ISpElementListReference  inElementList,
  918.                                  UInt32                 inBufferCount,
  919.                                  UInt32 *                outCount,
  920.                                  ISpElementReference *    buffer);
  921.  
  922. EXTERN_API_C( OSStatus )
  923. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  924.                                  ISpElementKind         inKind,
  925.                                  UInt32                 inBufferCount,
  926.                                  UInt32 *                outCount,
  927.                                  ISpElementReference *    buffer);
  928.  
  929. EXTERN_API_C( OSStatus )
  930. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  931.                                  ISpElementLabel         inLabel,
  932.                                  UInt32                 inBufferCount,
  933.                                  UInt32 *                outCount,
  934.                                  ISpElementReference *    buffer);
  935.  
  936. /*
  937.  * ISpElementList_GetNextEvent
  938.  *
  939.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  940.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  941.  * was not enough space to fill in the whole event structure that event will be
  942.  * dequed, as much of the event as will fit in the buffer will by copied and
  943.  * ISpElementList_GetNextEvent will return an error.
  944.  *
  945.  * Return Codes
  946.  * paramErr
  947.  *
  948.  */
  949. EXTERN_API_C( OSStatus )
  950. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  951.                                  UInt32                 bufSize,
  952.                                  ISpElementEventPtr     event,
  953.                                  Boolean *                wasEvent);
  954.  
  955. /*
  956.  *
  957.  * ISpElementList_Flush
  958.  *
  959.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  960.  * that any events that made it to this layer before the time of the flush call will be flushed and
  961.  * it will not flush any events that make it to this layer after the time when the call has returned.
  962.  * What happens to events that occur during the flush is undefined.
  963.  *
  964.  *
  965.  * Return Codes
  966.  * paramErr
  967.  *
  968.  */
  969. EXTERN_API_C( OSStatus )
  970. ISpElementList_Flush            (ISpElementListReference  inElementList);
  971.  
  972. /*
  973.  *
  974.  * ISpTimeToMicroseconds
  975.  *
  976.  *
  977.  * This function takes time from an input sprocket event and converts it
  978.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  979.  *
  980.  *
  981.  * Return Codes
  982.  * paramErr
  983.  *
  984.  */
  985. EXTERN_API_C( OSStatus )
  986. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  987.                                  UnsignedWide *            outMicroseconds);
  988.  
  989. /*
  990.  *
  991.  * ISpUptime
  992.  *
  993.  *
  994.  * This funtion returns the current machine dependant time, identical in form
  995.  * to that in an InputSprocket event. (Version 1.1 or later of InputSprocket).
  996.  *
  997.  *
  998.  */
  999. EXTERN_API_C( AbsoluteTime )
  1000. ISpUptime                        (void);
  1001.  
  1002.  
  1003. /****************************************************************************/
  1004. /*    Interfaces for InputSprocket Drivers                                    */
  1005. /*                                                                            */
  1006. /*    These APIs should be called only from InputSprocket drivers                */
  1007. /*                                                                            */
  1008. /*    (Moved from InputSprocketDriver.h, which is now obsolete.                */
  1009. /****************************************************************************/
  1010.  
  1011. /*
  1012.  
  1013. Resource File Concerns
  1014.  
  1015. 1. All resource ids of a driver should be in the range of 256 to 2048
  1016. and the res file should only be open while the drivers panel is visable.
  1017.  
  1018. */
  1019. #endif  /* CALL_NOT_IN_CARBON */
  1020.  
  1021. enum {
  1022.     kOSType_ISpDriverFileType    = FOUR_CHAR_CODE('shlb'),
  1023.     kOSType_ISpDriverCreator    = FOUR_CHAR_CODE('insp')
  1024. };
  1025.  
  1026. /*
  1027.  *
  1028.  * this function will plot an icon suite of the application (usually for a need)
  1029.  *
  1030.  */
  1031. #if CALL_NOT_IN_CARBON
  1032. EXTERN_API_C( OSErr )
  1033. ISpPlotAppIconSuite                (const Rect *            theRect,
  1034.                                  IconAlignmentType         align,
  1035.                                  IconTransformType         transform,
  1036.                                  short                     iconSuiteResourceId);
  1037.  
  1038. /* label2,5,6,7, disabled and offline are reserved*/
  1039.  
  1040. #endif  /* CALL_NOT_IN_CARBON */
  1041.  
  1042. enum {
  1043.     kISpIconTransform_Selected    = kTransformSelected,            /* choose one of these (optionally) (these all erase what is behind them to the dialog color)*/
  1044.     kISpIconTransform_PlotIcon    = kTransformLabel1,
  1045.     kISpIconTransform_PlotPopupButton = kTransformLabel3,
  1046.     kISpIconTransform_PlotButton = kTransformLabel4,            /* use this is you want to plot the icon while the devices button is pressed*/
  1047.                                                                 /* or the devices axis is activated and so on*/
  1048.     kISpIconTransform_DeviceActive = kTransformOpen
  1049. };
  1050.  
  1051.  
  1052. typedef UInt32 ISpMetaHandlerSelector;
  1053. enum {
  1054.     kISpSelector_Init            = 1,
  1055.     kISpSelector_Stop            = 2,
  1056.     kISpSelector_GetSize        = 3,
  1057.     kISpSelector_HandleEvent    = 4,
  1058.     kISpSelector_Show            = 5,
  1059.     kISpSelector_Hide            = 6,
  1060.     kISpSelector_BeginConfiguration = 7,
  1061.     kISpSelector_EndConfiguration = 8,
  1062.     kISpSelector_GetIcon        = 9,
  1063.     kISpSelector_GetState        = 10,
  1064.     kISpSelector_SetState        = 11,
  1065.     kISpSelector_Dirty            = 12,
  1066.     kISpSelector_SetActive        = 13,
  1067.     kISpSelector_DialogItemHit    = 14,
  1068.     kISpSelector_Tickle            = 15,                            /* 1.03 and later*/
  1069.     kISpSelector_InterruptTickle = 16,
  1070.     kISpSelector_Draw            = 17,
  1071.     kISpSelector_Click            = 18,
  1072.     kISpSelector_ADBReInit        = 19,                            /* 1.2 and later*/
  1073.     kISpSelector_GetCalibration    = 20,                            /* 1.7 and later*/
  1074.     kISpSelector_SetCalibration    = 21,
  1075.     kISpSelector_CalibrateDialog = 22
  1076. };
  1077.  
  1078.  
  1079. /*
  1080.  *
  1081.  * typedefs for the function pointers the metahandler may return 
  1082.  *
  1083.  */
  1084. /* a generic driver function pointer */
  1085. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Generic )(UInt32 refCon,  ...);
  1086. /* the meta handler pointer */
  1087. typedef CALLBACK_API_C( ISpDriverFunctionPtr_Generic , ISpDriverFunctionPtr_MetaHandler )(UInt32 refCon, ISpMetaHandlerSelector metaHandlerSelector);
  1088. /* the pointers you get through the meta handler */
  1089. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Init )(UInt32 refCon, UInt32 count, ISpNeed needs[], ISpElementReference virtualElements[], Boolean used[], OSType appCreatorCode, OSType subCreatorCode, UInt32 reserved, void *reserved2);
  1090. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Stop )(UInt32 refCon);
  1091. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetSize )(UInt32 refCon, Point *minimum, Point *best);
  1092. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_HandleEvent )(UInt32 refCon, EventRecord *theEvent, Boolean *handled);
  1093. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Show )(UInt32 refCon, DialogPtr theDialog, short dialogItemNumber, Rect *r);
  1094. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Hide )(UInt32 refCon);
  1095. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_BeginConfiguration )(UInt32 refCon, UInt32 count, ISpNeed needs[]);
  1096. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_EndConfiguration )(UInt32 refCon, Boolean accept);
  1097. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetIcon )(UInt32 refCon, short *iconSuiteResourceId);
  1098. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetState )(UInt32 refCon, UInt32 buflen, void *buffer, UInt32 *length);
  1099. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetState )(UInt32 refCon, UInt32 length, void *buffer);
  1100. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Dirty )(UInt32 refCon, Boolean *dirty);
  1101. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetActive )(UInt32 refCon, Boolean active);
  1102. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_DialogItemHit )(UInt32 refCon, short itemHit);
  1103. /* 1.03 and later*/
  1104. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Tickle )(UInt32 refCon);
  1105. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_InterruptTickle )(UInt32 refCon);
  1106. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Draw )(UInt32 refCon);
  1107. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Click )(UInt32 refCon, const EventRecord *event);
  1108. /* 1.2 and later*/
  1109. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_ADBReInit )(UInt32 refCon, Boolean inPostProcess);
  1110. /* 1.7 and later*/
  1111. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetCalibration )(UInt32 refCon, void *calibration, Size *calibrationSize);
  1112. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetCalibration )(UInt32 refCon, void *calibration, Size calibrationSize);
  1113. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_CalibrateDialog )(UInt32 refCon, Boolean *changed);
  1114. /* these functions are exported in the driver's pef container (1.7 or later)*/
  1115. #if CALL_NOT_IN_CARBON
  1116. EXTERN_API_C( OSStatus )
  1117. ISpDriver_CheckConfiguration    (Boolean *                validConfiguration);
  1118.  
  1119. EXTERN_API_C( OSStatus )
  1120. ISpDriver_FindAndLoadDevices    (Boolean *                keepDriverLoaded);
  1121.  
  1122. EXTERN_API_C( OSStatus )
  1123. ISpDriver_DisposeDevices        (void);
  1124.  
  1125. EXTERN_API_C( void )
  1126. ISpDriver_Tickle                (void);
  1127.  
  1128. #endif  /* CALL_NOT_IN_CARBON */
  1129.  
  1130. typedef CALLBACK_API_C( OSStatus , ISpDriver_CheckConfigurationPtr )(Boolean *validConfiguration);
  1131. typedef CALLBACK_API_C( OSStatus , ISpDriver_FindAndLoadDevicesPtr )(Boolean *keepDriverLoaded);
  1132. typedef CALLBACK_API_C( OSStatus , ISpDriver_DisposeDevicesPtr )(void );
  1133. typedef CALLBACK_API_C( void , ISpDriver_TicklePtr )(void );
  1134. /* ********************* driver level functions ********************* */
  1135.  
  1136. /*
  1137.  *
  1138.  * ISpDevice_New
  1139.  *
  1140.  * This creates a new device from the device definition structure and returns
  1141.  * the result into the device reference.
  1142.  *
  1143.  * Returns Codes
  1144.  * paramErr
  1145.  * out of memory
  1146.  * 
  1147.  * Specical Considerations
  1148.  * may not be done at interrupt time
  1149.  */
  1150. #if CALL_NOT_IN_CARBON
  1151. EXTERN_API_C( OSStatus )
  1152. ISpDevice_New                    (const ISpDeviceDefinition * inStruct,
  1153.                                  ISpDriverFunctionPtr_MetaHandler  metaHandler,
  1154.                                  UInt32                 refCon,
  1155.                                  ISpDeviceReference *    outReference);
  1156.  
  1157. /*
  1158.  * ISpDevice_Dispose
  1159.  *
  1160.  * This disposes an existing device.
  1161.  *
  1162.  * Returns Codes
  1163.  * paramErr
  1164.  *
  1165.  * Special Considerations
  1166.  * May not be done at interrupt time
  1167.  *
  1168.  */
  1169. EXTERN_API_C( OSStatus )
  1170. ISpDevice_Dispose                (ISpDeviceReference     inReference);
  1171.  
  1172.  
  1173. /*
  1174.  *
  1175.  * ISpElementDefinitionStruct
  1176.  *
  1177.  * This is the structure that defines everything static about this
  1178.  * element.  For each element on your device you will need to 
  1179.  * fill in one of these structures when your driver loads.
  1180.  *
  1181.  */
  1182. #endif  /* CALL_NOT_IN_CARBON */
  1183.  
  1184. struct ISpElementDefinitionStruct
  1185. {
  1186.     ISpDeviceReference device;  /* device this element belongs to */
  1187.     UInt32 group;                /* group this element belongs to or 0 */
  1188.  
  1189.     Str63 theString;         /* a string that is a human readable identifier for this element, internationalization ? */
  1190.  
  1191.     ISpElementKind kind;
  1192.     ISpElementLabel label;
  1193.  
  1194.     void *configInfo;         /* a pointer to the buffer containing the configuration information for this element */
  1195.     UInt32 configInfoLength; /* length of that configuration info */
  1196.  
  1197.     UInt32 dataSize;         /* the size of the data, so we can generate an appropriate buffer */
  1198.  
  1199.     UInt32 reserved1;
  1200.     UInt32 reserved2;
  1201.     UInt32 reserved3;
  1202. };
  1203. typedef struct ISpElementDefinitionStruct ISpElementDefinitionStruct;
  1204. /*
  1205.  *
  1206.  * ISpElement_New
  1207.  *
  1208.  * ISpElement_New takes an element definition struct and gives you back a element reference.
  1209.  * When you produce data you use that element reference to give the data to the system.
  1210.  * 
  1211.  * Return Codes
  1212.  * paramErr
  1213.  * memory error
  1214.  *
  1215.  * Special Considerations
  1216.  * The ISpElement_New function may move or purge memory.  Your application should not call this function 
  1217.  * at interrupt time.
  1218.  * 
  1219.  */
  1220. #if CALL_NOT_IN_CARBON
  1221. EXTERN_API_C( OSStatus )
  1222. ISpElement_New                    (const ISpElementDefinitionStruct * inStruct,
  1223.                                  ISpElementReference *    outElement);
  1224.  
  1225. /*
  1226.  *
  1227.  * ISpElement_Dispose
  1228.  *
  1229.  * ISpElement_Dispose takes an element reference and deletes it.
  1230.  * You should call this function when your driver unloads.
  1231.  *
  1232.  * Return Codes
  1233.  * paramErr
  1234.  * memory error
  1235.  *
  1236.  * Special Considerations
  1237.  * The ISpElement_Dispose function may move or purge memory.  Your application should not call this function 
  1238.  * at interrupt time.
  1239.  * 
  1240.  */
  1241. EXTERN_API_C( OSStatus )
  1242. ISpElement_Dispose                (ISpElementReference     inElement);
  1243.  
  1244. /*
  1245.  *
  1246.  * ISpElement_PushSimpleData
  1247.  *
  1248.  * ISpElement_PushSimpleData is the appropriate way to give the system data if your data fits exactly into
  1249.  * a 32 bit signed number.  You pass the element reference that goes with the data, the data and the 
  1250.  * AbsoluteTime that data was produced.  If UpTime is not available you should fill time.lo with the
  1251.  * TickCount time and time.hi with 0.
  1252.  *
  1253.  * Return Codes
  1254.  * paramErr
  1255.  *
  1256.  */
  1257. EXTERN_API_C( OSStatus )
  1258. ISpElement_PushSimpleData        (ISpElementReference     inElement,
  1259.                                  UInt32                 data,
  1260.                                  const AbsoluteTime *    time);
  1261.  
  1262. /*
  1263.  *
  1264.  * ISpElement_PushComplexData
  1265.  *
  1266.  * ISpElement_PushComplexData is exactly like ISpElement_PushSimpleData except that it is appropriate for times
  1267.  * when your data does not fit into a signed 32 bit integer.
  1268.  *
  1269.  * Instead it takes the length of your data (which must match the datasize field of your ISpElementDefinitionStruct)
  1270.  * and a ptr to the devices state.
  1271.  *
  1272.  * Return Codes
  1273.  * paramErr
  1274.  *
  1275.  */
  1276. EXTERN_API_C( OSStatus )
  1277. ISpElement_PushComplexData        (ISpElementReference     inElement,
  1278.                                  UInt32                 buflen,
  1279.                                  void *                    state,
  1280.                                  const AbsoluteTime *    time);
  1281.  
  1282. /*  ***********************************************************************************  */
  1283. #endif  /* CALL_NOT_IN_CARBON */
  1284.  
  1285.  
  1286. typedef UInt32                             ISpADBDeferRef;
  1287. typedef CALLBACK_API_C( void , ISpADBDeferCallbackProcPtr )(UInt8 adbCommand, void *adbBuffer, UInt32 refcon);
  1288. #if CALL_NOT_IN_CARBON
  1289. EXTERN_API_C( OSErr )
  1290. ISpAllocateADBDeferBlock        (ISpADBDeferRef *        createBlock);
  1291.  
  1292. EXTERN_API_C( OSErr )
  1293. ISpDisposeADBDeferBlock            (ISpADBDeferRef         disposeBlock);
  1294.  
  1295. EXTERN_API_C( OSErr )
  1296. ISpInstallADBDefer                (ISpADBDeferRef         refBlock,
  1297.                                  ADBAddress             reqAddress,
  1298.                                  ISpADBDeferCallbackProcPtr  installProc,
  1299.                                  UInt32                 clientRefCon,
  1300.                                  ADBServiceRoutineUPP *    prevRoutine,
  1301.                                  Ptr *                    prevDataArea);
  1302.  
  1303. EXTERN_API_C( OSErr )
  1304. ISpRemoveADBDefer                (ISpADBDeferRef         refBlock);
  1305.  
  1306. #endif  /* CALL_NOT_IN_CARBON */
  1307.  
  1308.  
  1309. #if PRAGMA_STRUCT_ALIGN
  1310.     #pragma options align=reset
  1311. #elif PRAGMA_STRUCT_PACKPUSH
  1312.     #pragma pack(pop)
  1313. #elif PRAGMA_STRUCT_PACK
  1314.     #pragma pack()
  1315. #endif
  1316.  
  1317. #ifdef PRAGMA_IMPORT_OFF
  1318. #pragma import off
  1319. #elif PRAGMA_IMPORT
  1320. #pragma import reset
  1321. #endif
  1322.  
  1323. #ifdef __cplusplus
  1324. }
  1325. #endif
  1326.  
  1327. #endif /* __INPUTSPROCKET__ */
  1328.  
  1329.